How to Convert Grayscale to Transparency in Krita

Share
In this tutorial, we'll learn how take a grayscale image or layer and make the black color fully transparent and the white fully opaque, or vice-versa, in Krita (version 5.2). In other words, we'll convert lightness into alpha. This is useful if you have a black and white image that you want to use as clipping mask, or if you have a line art layer that has white background and you don't want to use the multiply blend mode.

To convert grayscale to transparency in Krita, follow the following steps:

1: open the image that you want to edit in Krita.

2: select the layer that you want to convert, and add the filter Adjust -> Cross-channel color adjustment to it. In the filter settings, you should see two dropdown list buttons, one for "Channel" and one for "Driver channel," and a curve editor.

3: change "Channel" to "Alpha."

4: change "Driver channel" to "Lightness."

5: make the curve a slope by moving the left point to the bottom-left and the right point to the top-right. Click "OK" to apply the filter.

This will make every pixel in the layer have its alpha value equal to its lightness. Black pixels will become fully transparent, while white pixels will become fully opaque.

However, you'll see some black outlines around the white areas. Those are from gray pixels that became only semi-transparent. To fix this:

6: add a new fill layer. Make its color white if you want all the opaque parts to be white.

7: make the fill layer inherit the alpha from below by clicking its "a" icon in the "Layers" docker next to the padlock.

Note: if you have other layers in the document, you'll have to put the fill layer, the filter, and the grayscale layer in a layer group for the "Inherit Alpha" setting to work.

The cross channel color adjustment filter in Krita, turning lightness into alpha; and a white fill layer with inherit alpha.

8: save your image.

Inverting the Colors

The tutorial above will make black transparent and white opaque. To do the opposite, simply follow the same steps but make the slope go to from top to bottom instead of from bottom to top.

Alternatively: before applying the Cross-channel color adjustment, invert the color of the pixels with the Adjust -> Invert filter.

Comments

Leave a Reply

Leave your thoughts! Required fields are marked *